/*
 * WebService.h
 *
 *  Created on: 2021年12月26日
 *      Author: vicent-PC
 */
#ifndef MAIN_HAL_SERVERS_WEB_SOCKET_SERVICE_H_
#define MAIN_HAL_SERVERS_WEB_SOCKET_SERVICE_H_
#include <stdint.h>

#define MAX_REQUEST_STRING_SIZE (128)
struct ClientsMsg {
    /* data */
    int clientId;
    uint8_t pMsg[MAX_REQUEST_STRING_SIZE];
    uint16_t msgLen;
};

enum {
    WEB_SOCKET_NOT_STARTED = 1,
    WEB_SOCKET_STARTED,
};

class WebSocketService {
   public:
    static WebSocketService* m_pInstance;

   public:
    WebSocketService(){};
    ~WebSocketService(){};
    static WebSocketService* getInstance() {
        if (m_pInstance == nullptr) m_pInstance = new WebSocketService();
        return m_pInstance;
    }
    int start();
    int registerStreamSocket(void* streamSrc = nullptr);
    int postData(uint8_t* buf, int len);
    int postDataImmediately(uint8_t* buf, int len);
    int getStatus() { return mStatus; }

   private:
    int mStatus = WEB_SOCKET_NOT_STARTED;
};

class WebSocketClientManager {
   public:
    WebSocketClientManager(){};
    ~WebSocketClientManager(){};
    int wait() { return 0; };
};

#endif /* MAIN_HAL_SERVERS_WEB_SOCKET_SERVICE_H_ */
